<?php
	namespace qyouHome\Model;
	use Think\Model;
	class PlaninfoModel extends Model {
		public function plan(){
			$plan = M('planinfo');
			$list = $plan->order('Plan_time desc')->limit(10)->select();
			for($i=0;$i<count($list);$i++){ 
				$list[$i]['endnum']       = count(explode(",",$list[$i]['end']));
				$list[$i]['endnumbefore'] = $list[$i]['endnum']-1;
				$list[$i]['end']          = explode(",",$list[$i]['end']);
				$list[$i]['endplace']     = $list[$i]['end'][$list[$i]['endnum']-1];
				$list[$i]['host_photo']     = explode(",",$list[$i]['host_photo']);
				$list[$i]['host_photo']=empty($list[$i]['host_photo'][0]) ? 'none':$list[$i]['host_photo'];
				$list[$i]['host_photo_num'] = count($list[$i]['host_photo']);
				$list[$i]['plan_time_a']    = date("Y-m-d H:i:s",$list[$i]['plan_time']);
				$list[$i]['plan_time']      = date("Y-m-d",$list[$i]['plan_time']);
			}
			return $list;
		}
	}
?>